// 创建所有必要的页面文件
const fs = require('fs')
const path = require('path')

// 页面模板
const pageTemplate = (title, className) => `<template>
  <div class="${className}">
    <el-card>
      <template #header>
        <div class="card-header">
          <span class="title">${title}</span>
        </div>
      </template>
      <div class="content">
        <p>${title}页面开发中...</p>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
// ${title}页面
</script>

<style lang="scss" scoped>
.${className} .content {
  padding: 40px;
  text-align: center;
  color: $text-color-secondary;
}
</style>`

// 需要创建的页面列表
const pages = [
  // 简历管理
  { path: 'src/views/resume/ResumeReview.vue', title: '简历审核', className: 'resume-review' },
  { path: 'src/views/resume/ResumeTemplates.vue', title: '简历模板', className: 'resume-templates' },
  
  // 面试管理
  { path: 'src/views/interviews/InterviewList.vue', title: '面试列表', className: 'interview-list' },
  { path: 'src/views/interviews/InterviewSchedule.vue', title: '安排面试', className: 'interview-schedule' },
  { path: 'src/views/interviews/InterviewPractice.vue', title: '面试练习', className: 'interview-practice' },
  { path: 'src/views/interviews/InterviewQuestions.vue', title: '题库管理', className: 'interview-questions' },
  { path: 'src/views/interviews/InterviewStatistics.vue', title: '面试统计', className: 'interview-statistics' },
  
  // 岗位管理
  { path: 'src/views/jobs/JobList.vue', title: '岗位列表', className: 'job-list' },
  { path: 'src/views/jobs/JobForm.vue', title: '岗位表单', className: 'job-form' },
  { path: 'src/views/jobs/JobDetail.vue', title: '岗位详情', className: 'job-detail' },
  { path: 'src/views/jobs/JobApplications.vue', title: '申请管理', className: 'job-applications' },
  { path: 'src/views/jobs/MyJobApplications.vue', title: '我的申请', className: 'my-job-applications' },
  { path: 'src/views/jobs/Companies.vue', title: '公司管理', className: 'companies' },
  
  // 通知中心
  { path: 'src/views/notifications/NotificationList.vue', title: '通知中心', className: 'notification-list' },
  
  // 文件管理
  { path: 'src/views/files/FileList.vue', title: '文件管理', className: 'file-list' },
  
  // 系统管理
  { path: 'src/views/system/UserList.vue', title: '用户管理', className: 'user-list' },
  { path: 'src/views/system/RoleList.vue', title: '角色权限', className: 'role-list' },
  { path: 'src/views/system/LogList.vue', title: '系统日志', className: 'log-list' },
  { path: 'src/views/system/SystemSettings.vue', title: '系统设置', className: 'system-settings' },
  
  // 个人中心
  { path: 'src/views/profile/Index.vue', title: '个人中心', className: 'profile' }
]

// 创建目录
function ensureDir(filePath) {
  const dir = path.dirname(filePath)
  if (!fs.existsSync(dir)) {
    fs.mkdirSync(dir, { recursive: true })
  }
}

// 创建页面文件
pages.forEach(page => {
  const filePath = path.join(__dirname, page.path)
  
  // 确保目录存在
  ensureDir(filePath)
  
  // 如果文件不存在，则创建
  if (!fs.existsSync(filePath)) {
    const content = pageTemplate(page.title, page.className)
    fs.writeFileSync(filePath, content, 'utf8')
    console.log(`Created: ${page.path}`)
  } else {
    console.log(`Exists: ${page.path}`)
  }
})

console.log('All pages created successfully!')
